*out_objtype = (OstreeObjectType)objtype_u32;
}
-static void
-checksum_to_bytes (const char *checksum,
- guchar *buf)
+/**
+ * ostree_checksum_inplace_to_bytes:
+ * @checksum: a SHA256 string
+ * @buf: Output buffer with at least 32 bytes of space
+ *
+ * Convert @checksum from a string to binary in-place, without
+ * allocating memory. Use this function in hot code paths.
+ */
+void
+ostree_checksum_inplace_to_bytes (const char *checksum,
+ guchar *buf)
{
guint i;
guint j;
ostree_checksum_to_bytes (const char *checksum)
{
guchar *ret = g_malloc (32);
- checksum_to_bytes (checksum, ret);
+ ostree_checksum_inplace_to_bytes (checksum, ret);
return ret;
}
ostree_checksum_to_bytes_v (const char *checksum)
{
guchar result[32];
- checksum_to_bytes (checksum, result);
+ ostree_checksum_inplace_to_bytes (checksum, result);
return ot_gvariant_new_bytearray ((guchar*)result, 32);
}
void ostree_checksum_inplace_from_bytes (const guchar *bytes,
char *buf);
+void ostree_checksum_inplace_to_bytes (const char *checksum,
+ guchar *buf);
+
const guchar *ostree_checksum_bytes_peek (GVariant *bytes);
int ostree_cmp_checksum_bytes (const guchar *a, const guchar *b);